import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/svg.dart';
import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart';
import '../views/gallery.dart';


import '../../../utils/tips.dart';

class ShareDialog extends Dialog {
  final List galleryData;
  final changePickPicState;
  final share;

  const ShareDialog({Key? key, required this.galleryData,required this.changePickPicState,required this.share}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    void setIndex(int index){
      print(index);
    }

    return Column(
      children: [
        Container(
          padding: EdgeInsets.fromLTRB(20, 16, 20, 16),
          height: 56,
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Expanded(
                child: Center(
                  child: Text(
                    '分享',
                    style: TextStyle(
                      fontSize: 16.0,
                      color: Color(0xFF333333),
                      fontWeight: FontWeight.w600,
                    ),
                  ),
                ),
              ),
              InkWell(
                child: Image.asset(
                  'assets/images/icon_poup_window_close.png',
                  width: 10.w,
                  height: 10.h,
                ),
                onTap: () {
                  Navigator.pop(context);
                },
              ),
            ],
          ),
        ),
        SizedBox(height: 50,),
        Expanded(child: Container(child: Gallery(galleryData: galleryData,changePickPicState:changePickPicState,isPureReview:false,setIndex:setIndex),
          color: Color(0xFFF3F2F8)
        ),
        ),
        Container(
          color: Colors.white,
          height: 64,
          child:Padding(padding: EdgeInsets.only(left: 60.0, right: 60.0,top:12
          ),
            child:
            Row(
                children: [
                  InkWell(child: Column(children: [
                    Image.asset('assets/images/translate_photo_share_text.png',width: 24.0,height:  24.0,),
                    SizedBox(height: 5,),
                    Text('分享文本',style:TextStyle(color:Color(0xFF8A8A8E)))
                  ],),
                    onTap: (){
                     share('text');
                    },
                  ),

                  Spacer(),
                  InkWell(child: Column(children: [
                    Image.asset('assets/images/translate_photo_share_pic.png',width: 24.0,height:  24.0,),
                    SizedBox(height: 5,),
                    Text('分享图像',style:TextStyle(color:Color(0xFF8A8A8E)))
                  ],),
                    onTap: (){
                      share('pic');
                    },
                  ),
                  Spacer(),
                  InkWell(child: Column(children: [
                    Image.asset('assets/images/translate_photo_save_pic.png',width: 24.0,height:  24.0,),
                    SizedBox(height: 5,),
                    Text('保存图像',style:TextStyle(color:Color(0xFF8A8A8E)))
                  ],),
                    onTap: (){
                      share('album');
                    },
                  ),
                ]

            ),
          ) ,
        ),


      ],
    );
  }
}
